package com.chenfubing.ps.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chenfubing.ps.entity.Order;
import com.chenfubing.ps.entity.result.JsonResult;
import com.chenfubing.ps.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author chenfubing
 * @since 2020-05-05
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private IOrderService iOrderService;

    /**
     * 获取订单分页
     * @return
     */
    @GetMapping("/getOrderPage")
    public JsonResult getOrderPage(@RequestParam int pageNum,@RequestParam int pageSize) {
        return new JsonResult(iOrderService.getOrderPage(pageNum,pageSize));
    }

    @GetMapping("/deleteOder")
    public JsonResult deleteOder(@RequestParam int id)
    {
        return new JsonResult(iOrderService.getBaseMapper().deleteById(id)) ;
    }

    @GetMapping("/export")
    public JsonResult export()
    {
        iOrderService.export();
        return new JsonResult();
    }

}
